package viewBusinessFacade;

import business.AbstractDocument;
import business.CDocument;
import business.JavaDocument;
import business.Project;
import business.TxtDocument;
import business.User;

public class GUIFacade
{
    private final String JAVA_EXTENSION = ".java";
    private final String C_EXTENSION = ".c";
    private final String TXT_EXTENSION = ".txt";

    private User newUser = null;
    private Project newProj = null;
    private AbstractDocument newDoc = null;

    public void newUser(String nome, int idade, String login, String senha)
    {
        newUser = new User(nome, login);
    }

    public void newProject(String name, String type)
    {
        newProj = new Project(name, type);
    }

    public void newDocument(String title, String source)
    {
        switch(title.split(".")[1])
        {
            case JAVA_EXTENSION: newDoc = new JavaDocument(title, source);
            case C_EXTENSION: newDoc = new CDocument(title, source);
            case TXT_EXTENSION: newDoc = new TxtDocument(title, source);
        }
    }

    public User getUser()
    {
        return newUser;
    }

}
